package com.oriental.manage.service.reserve;

import com.oriental.manage.core.paging.Pagination;
import com.oriental.manage.core.response.ResponseDTO;
import com.oriental.reserve.api.config.AccountPushRuleConfigInterface;
import com.oriental.reserve.model.ResponseModel;
import com.oriental.reserve.model.config.AccountPushRuleConfigDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Author: Yang xp
 * Date: 2017/6/7
 * Time: 9:59
 * Desc：
 */
@Service
@Slf4j
public class AccountPushRuleService {

    @Autowired
    private AccountPushRuleConfigInterface accountPushRuleConfigInterface;

    public void searchAccountPushRule(Pagination<AccountPushRuleConfigDto> pagination, AccountPushRuleConfigDto accountTransTypeDto, ResponseDTO<Pagination<AccountPushRuleConfigDto>> responseDTO){
        ResponseModel<List<AccountPushRuleConfigDto>> responseModel = accountPushRuleConfigInterface.queryByModel (accountTransTypeDto);
        ReserveUtil.responseQueryHandle(responseModel,pagination,responseDTO,accountTransTypeDto,"查询成功");
    }

    public void addAccountPushRule(AccountPushRuleConfigDto model,ResponseDTO<String> responseDTO){
        ResponseModel<String> responseModel = accountPushRuleConfigInterface.createModel(model);
        ReserveUtil.responseHandle(responseModel,responseDTO,"新增成功");
    }

    public void updateAccountPushRule(AccountPushRuleConfigDto model,ResponseDTO<String> responseDTO){
        ResponseModel<String> responseModel = accountPushRuleConfigInterface.updateModel(model);
        ReserveUtil.responseHandle(responseModel,responseDTO,"修改成功");
    }

    public void deleteAccountPushRule(AccountPushRuleConfigDto model,ResponseDTO<String> responseDTO){
        ResponseModel<String> responseModel = accountPushRuleConfigInterface.deleteModel(model);
        ReserveUtil.responseHandle(responseModel,responseDTO,"删除成功");
    }

}
